/**
 *  *2010-7-26 下午04:41:52  add 
 */
package com.base.myproject.client.HR.Salary;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import com.base.myproject.client.HR.bcode.HrBcodeSelectButton;
import com.base.myproject.client.busi.BaseStore;
import com.base.myproject.client.busi.BO.BusiObject;
import com.base.myproject.client.busi.BO.TreeNodeModelData;
import com.base.myproject.client.jdbc.DataSet;
import com.base.myproject.client.jdbc.StoreInfo;
import com.base.myproject.client.ui.BaseFormPanel;
import com.base.myproject.client.ui.BaseGridPanel;
import com.base.myproject.client.ui.BaseJDBCPanel;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.NumberField;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.layout.TableData;
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel.CheckNodes;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * 年假策略
 * 
 * @author Administrator 2010-10-28 cxghiu410@gmail.com
 */
public class Year_Holiday_Ploy extends BaseJDBCPanel {
	BaseStore<BusiObject> store = null;
	TextArea mark;
	ColumnConfig systembcodecolumn;
	HrBcodeSelectButton hrbsb;
	HrBcodeSelectButton hrbsb_lw;
	ColumnConfig systembcodecolumn_lw;
	public Year_Holiday_Ploy() {
		init();
		
	}

	public void init() {
		initrenderer();
		initWedgitx();
		registerMainStore(mainstore);
	}

	private void initWedgitx() {
		HorizontalPanel hpanel = new HorizontalPanel();
		hpanel.add(createMGrid());
		VerticalPanel vpanel = new VerticalPanel();
		vpanel.setSpacing(1);
		hpanel.setSpacing(2);
		vpanel.add(createMForm());
		vpanel.add(createGrid());

		/*TabPanel panel = new TabPanel();
		panel.setPlain(true);
		panel.setSize(810, 166);
		
		initSelectGrid();
		
		TabItem zz_tab = new TabItem("组织");
		zz_tab.add(createBcodeGrid());
		hrbsb = new HrBcodeSelectButton()
		{
		public void doposted(List<TreeNodeModelData> modeldatalist) {
			for(TreeNodeModelData tnmd : modeldatalist)
			{
				HashMap hm = new HashMap();
				hm.put("systembcode", tnmd.get("systembcode"));
				hm.put("sheetcode", "Year_Holiday_Ploy");//这里是针对每个类用到组织条件的时候 添加进去类名  用于区分
				this.getTarget_store().add(hm);
			}
		}
		};
		hrbsb.setCheckNodes(CheckNodes.BOTH);
		hrbsb.setNeesreselect(true);
		hrbsb.setTarget_store(bcode_store);
		zz_tab.setAutoHeight(true);
		panel.add(zz_tab);
		
		TabItem zy_tab = new TabItem("职级");
		zy_tab.addStyleName("pad-text");
		zy_tab.add(zy_Grid);
		panel.add(zy_tab);

		TabItem ji_neng = new TabItem("雇佣组别");// hr_jobgroup
		ji_neng.addStyleName("pad-text");
		ji_neng.add(jobgroup_Grid);
		panel.add(ji_neng);

		TabItem z_j = new TabItem("雇佣性质"); // hr_jobproperty
		z_j.addStyleName("pad-text");
		z_j.add(jobproperty_Grid);
		panel.add(z_j);

		TabItem lb_tab = new TabItem("雇佣类别"); // hr_jobtype
		lb_tab.addStyleName("pad-text");
		lb_tab.add(jobtype_Grid);
		panel.add(lb_tab);

		TabItem zyzk_tab = new TabItem("雇佣状况"); // hr_jobtype
		zyzk_tab.addStyleName("pad-text");
		zyzk_tab.add(zyzk_Grid);
		panel.add(zyzk_tab);
		
		TabItem zyzk_hjq = new TabItem("户籍区"); // hr_jobtype
		zyzk_hjq.addStyleName("pad-text");
		zyzk_hjq.add(hjq_Grid);
		panel.add(zyzk_hjq);
		
		TabItem zyzk_cx = new TabItem("城/乡"); // hr_jobtype
		zyzk_cx.addStyleName("pad-text");
		zyzk_cx.add(cx_Grid);
		panel.add(zyzk_cx);
		
		//例外
		TabItem lw_tab = new TabItem("例外");
		lw_tab.add(createlwGrid());
		hrbsb_lw = new HrBcodeSelectButton()
		{
		public void doposted(List<TreeNodeModelData> modeldatalist) {
			for(TreeNodeModelData tnmd : modeldatalist)
			{
				HashMap hm = new HashMap();
				hm.put("systembcode", tnmd.get("systembcode"));
				hm.put("sheetcode", "Year_Holiday_Ploy");
				this.getTarget_store().add(hm);
			}
		}
		};
		hrbsb_lw.setCheckNodes(CheckNodes.BOTH);
		hrbsb_lw.setNeesreselect(true);
		hrbsb_lw.setTarget_store(lw_store);
		lw_tab.setAutoHeight(true);
		panel.add(lw_tab);
		
		vpanel.add(panel);*/
		hpanel.add(vpanel);
		add(hpanel);
	}
	
	SelectGrid zy_Grid;
	SelectGrid jobgroup_Grid;
	SelectGrid jobproperty_Grid;
	SelectGrid jobtype_Grid;
	SelectGrid zyzk_Grid;
	SelectGrid hjq_Grid;
	SelectGrid  cx_Grid;
	void initSelectGrid() {
		// 创建多个Grid应用的table页中
		//职级
		zy_Grid = new SelectGrid(
				mainstore,
				"hr_range_zy_c",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'zy' ) as a left join  (select distinct code,isset,upcode from hr_range_zy_c where upcode = '{icode}' and sheetcode='Year_Holiday_Ploy' ) as b on a.code = b.code",
				"icode","Year_Holiday_Ploy");	
		// 雇佣组别
		jobgroup_Grid = new SelectGrid(
				mainstore,
				"hr_range_jobgroup",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_jobgroup' ) as a left join  (select code,isset,upcode from hr_range_jobgroup where upcode = '{icode}' and sheetcode='Year_Holiday_Ploy'  ) as b on a.code = b.code",
				"icode","Year_Holiday_Ploy");
		// 雇佣性质
		jobproperty_Grid = new SelectGrid(
				mainstore,
				"hr_range_jobproperty",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_jobproperty' ) as a left join  (select code,isset,upcode from hr_range_jobproperty where upcode = '{icode}' and sheetcode='Year_Holiday_Ploy'  ) as b on a.code = b.code",
				"icode","Year_Holiday_Ploy");
		// 雇佣类别
		jobtype_Grid = new SelectGrid(
				mainstore,
				"hr_range_jobtype",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_jobtype' ) as a left join  (select code,isset,upcode from hr_range_jobtype where upcode = '{icode}'  and sheetcode='Year_Holiday_Ploy' ) as b on a.code = b.code",
				"icode","Year_Holiday_Ploy");
		// 雇佣状况
		zyzk_Grid = new SelectGrid(
				mainstore,
				"hr_range_zyzk",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'zyzk' ) as a left join  (select code,isset,upcode from hr_range_zyzk where upcode = '{icode}'  and sheetcode='Year_Holiday_Ploy' ) as b on a.code = b.code",
				"icode","Year_Holiday_Ploy");
		
		//户籍区
		hjq_Grid = new SelectGrid(
				mainstore,
				"hr_range_hjq",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_a' ) as a left join  (select code,isset,upcode from hr_range_hjq where upcode = '{icode}'  and sheetcode='Year_Holiday_Ploy' ) as b on a.code = b.code",
				"icode","Year_Holiday_Ploy");
		//城乡
		cx_Grid = new SelectGrid(
				mainstore,
				"hr_range_cx",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_cz' ) as a left join  (select code,isset,upcode from hr_range_cx where upcode = '{icode}'  and sheetcode='Year_Holiday_Ploy' ) as b on a.code = b.code",
				"icode","Year_Holiday_Ploy");
		
		
		
		zy_Grid.setHeight(120);
		jobgroup_Grid.setHeight(120);
		jobproperty_Grid.setHeight(120);
		jobtype_Grid.setHeight(120);
		zyzk_Grid.setHeight(120);
		hjq_Grid.setHeight(120);
		cx_Grid.setHeight(120);
	}
	
	BaseStore<BusiObject> bcode_store = null;
	BaseStore<BusiObject> getBcodeStore() {
		if (bcode_store == null) {
			createBcodeStore();
		}
		return bcode_store;
	}
	BaseStore<BusiObject> createBcodeStore() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("systembcode");
		type.getField("systembcode").setType(String.class);
		type.addField("upcode");
		type.getField("upcode").setType(String.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_range_bcode");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_range_bcode where sheetcode='Year_Holiday_Ploy' and upcode ='{icode}'");
		 info.setParent(mainstore);// 关联主表
		 info.setLinkparentcolumns(new String[] { "icode" }); // 关联主表字段
		 info.setLinkparent_chile_columns(new String[] { "upcode" });//
		// 关联主表字段
		bcode_store = new BaseStore<BusiObject>(type, info);
		return bcode_store;
	}
	BaseGridPanel bcodegrid = null;
	BaseGridPanel createBcodeGrid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());
		systembcodecolumn = new ColumnConfig("systembcode", "部门人员", 80);
		columns.add(systembcodecolumn);
		ColumnModel cm = new ColumnModel(columns);
		bcodegrid = new BaseGridPanel(getBcodeStore(), cm, true, true)
		{
			protected void addnewrecord() {
				addrecord();
			}
		};
		cbs.setSelectionMode(SelectionMode.SINGLE);
		bcodegrid.getBg().setSelectionModel(cbs);
		bcodegrid.getBg().setHeight(110);
		bcodegrid.getBg().setBorders(false);
		return bcodegrid;
	}	
	void addrecord() {
		hrbsb.showEditor();
	}	

	BaseStore<BusiObject> mainstore = null;

	BaseStore<BusiObject> getMStore() {
		if (mainstore == null) {
			createMStore();
		}
		return mainstore;
	}

	BaseStore<BusiObject> createMStore() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("codename");
		type.getField("codename").setType(String.class);
		type.addField("mark");
		type.getField("mark").setType(String.class);
		type.addField("ploystartdate");
		type.getField("ploystartdate").setType(Date.class);
		type.addField("ployenddate");
		type.getField("ployenddate").setType(Date.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_Attendance_yearholiday_ploy_m");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_Attendance_yearholiday_ploy_m");
		mainstore = new BaseStore<BusiObject>(type, info){};
		
		return mainstore;
	}

	BaseGridPanel maingrid = null;

	BaseGridPanel createMGrid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());
		//
	
		ColumnConfig C2 = new ColumnConfig("codename", "名称：", 80);
		columns.add(C2);


		ColumnModel cm = new ColumnModel(columns);
		maingrid = new BaseGridPanel(getMStore(), cm, true, true);
		cbs.setSelectionMode(SelectionMode.SINGLE);
		maingrid.getBg().setSelectionModel(cbs);
		maingrid.getBg().setHeight(400);
		//Tools.setResize(maingrid.getBg(),0.25,0.88);
		return maingrid;
	}

	BaseFormPanel createMForm() {
		BaseFormPanel mainform = new BaseFormPanel(getMStore());
		TableLayout tl = new TableLayout(6);

		TableData td = new TableData();
		TableData td2 = new TableData();
		td2.setColspan(5);
		td.setRowspan(1);
		td.setHorizontalAlign(HorizontalAlignment.LEFT);
		td.setVerticalAlign(VerticalAlignment.TOP);
		td.setPadding(2);
		
		td2.setRowspan(1);
		td2.setHorizontalAlign(HorizontalAlignment.LEFT);
		td2.setVerticalAlign(VerticalAlignment.TOP);
		td2.setPadding(2);
		
		mainform.setLayout(tl);
		mainform.setHeaderVisible(false);

		mainform.add(new Label("名称:"), td);
		TextField<String> C_num2 = new TextField<String>();
		C_num2.setName("codename");
		C_num2.setAllowBlank(false);
		mainform.add(C_num2, td);
		
		mainform.add(new Label("策略有效期从:"), td);
		DateField C_num3 = new DateField();
		C_num3.getPropertyEditor().setFormat(
				DateTimeFormat.getFormat("yyyy-MM-dd"));
		C_num3.setName("ploystartdate");
		C_num3.setAllowBlank(false);
		mainform.add(C_num3, td);
		
		
		mainform.add(new Label("策略有效期到:"), td);
		DateField C_num4 = new DateField();
		C_num4.getPropertyEditor().setFormat(
				DateTimeFormat.getFormat("yyyy-MM-dd"));
		C_num4.setAllowBlank(false);
		C_num4.setName("ployenddate");
		mainform.add(C_num4, td);
		
		/*mainform.add(new Label("备注:"), td);
		mark = new TextArea();
		mark.setFireChangeEventOnSetValue(true);
		mark.setWidth(480);
		mark.setHeight(110);
	//	mark.setEnabled(false);
		mark.setName("mark");
		mainform.add(mark, td2);*/

		mainform.setWidth(810);
		mainform.setHeight(60);
		mainform.inited();

		return mainform;
	};

	BaseStore<BusiObject> getStore() {
		if (store == null) {
			createStore();
		}
		return store;
	}

	BaseStore<BusiObject> createStore() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("entryyearstart");
		type.getField("entryyearstart").setType(Double.class);
		type.addField("datanumber");
		type.getField("datanumber").setType(Integer.class);
		type.addField("entryyearend");
		type.getField("entryyearend").setType(Double.class);
		type.addField("codename");
		type.getField("codename").setType(String.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_Attendance_yearholiday_ploy");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_Attendance_yearholiday_ploy where codename='{codename}'");
		info.setParent(mainstore);// 关联主表
		info.setLinkparentcolumns(new String[] { "codename" }); // 关联主表字段
		info.setLinkparent_chile_columns(new String[] { "codename" });//
		// 关联主表字段
		store = new BaseStore<BusiObject>(type, info);
		
		return store;
	}
	
	BaseStore<BusiObject> lw_store = null;
	BaseStore<BusiObject> getlwStore() {
		if (lw_store == null) {
			createlwStore();
		}
		return lw_store;
	}
	BaseStore<BusiObject> createlwStore() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("systembcode");
		type.getField("systembcode").setType(String.class);
		type.addField("upcode");
		type.getField("upcode").setType(String.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_range_lw");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_range_lw where sheetcode='Year_Holiday_Ploy' and upcode ='{icode}'");
		 info.setParent(store);// 关联主表
		 info.setLinkparentcolumns(new String[] { "icode" }); // 关联主表字段
		 info.setLinkparent_chile_columns(new String[] { "upcode" });//
		// 关联主表字段
		 lw_store = new BaseStore<BusiObject>(type, info);
		return lw_store;
	}
	BaseGridPanel lwgrid = null;
	BaseGridPanel createlwGrid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());
		systembcodecolumn_lw = new ColumnConfig("systembcode", "部门人员", 80);
		columns.add(systembcodecolumn_lw);
		ColumnModel cm = new ColumnModel(columns);
		lwgrid = new BaseGridPanel(getlwStore(), cm, true, true)
		{
			protected void addnewrecord() {
				addlwrecord();
			}
		};
		cbs.setSelectionMode(SelectionMode.SINGLE);
		lwgrid.getBg().setSelectionModel(cbs);
		lwgrid.getBg().setHeight(110);
		lwgrid.getBg().setBorders(false);
		return lwgrid;
	}	
	void addlwrecord() {
		hrbsb_lw.showEditor();
	}

	BaseGridPanel grid = null;
	NumberField C_num3;
	NumberField C_num4;
	NumberField C_num5;
	NumberField C_num6;
	
	BaseGridPanel createGrid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());

		// ColumnConfig C1 = new ColumnConfig("icode", "icode", 80);
		// columns.add(C1);
		ColumnConfig C2 = new ColumnConfig("codename", "名称", 80);
		columns.add(C2);
		ColumnConfig C3 = new ColumnConfig("entryyearstart", "起始工作年限", 80);
		C_num3 = new NumberField();
		C_num3.setPropertyEditorType(Double.class);
		C_num3.setName("entryyearstart");
		C3.setEditor(new CellEditor(C_num3));
		columns.add(C3);
		ColumnConfig C4 = new ColumnConfig("entryyearend", "结束工作年限", 80);
		C_num4 = new NumberField();
		C_num4.setPropertyEditorType(Double.class);
		C_num4.setName("entryyearend");
		C4.setEditor(new CellEditor(C_num4));
		columns.add(C4);
		
		ColumnConfig C5 = new ColumnConfig("datanumber", "年假天数", 80);
		C_num5 = new NumberField();
		C_num5.setPropertyEditorType(Integer.class);
		C_num5.setName("datanumber");
		C5.setEditor(new CellEditor(C_num5));
		columns.add(C5);

		ColumnModel cm = new ColumnModel(columns);
		grid = new BaseGridPanel(getStore(), cm, true, true);
		cbs.setSelectionMode(SelectionMode.SINGLE);
		grid.getBg().setSelectionModel(cbs);
		//Tools.setResize(grid.getBg(),0.60,0.51);
		grid.getBg().setHeight(170);
		grid.getBg().setWidth(810);
		return grid;
	}
	
	int sync = 0;
	Listener<BaseEvent> defaultlistener;

	Listener<BaseEvent> getListener() {
		if (defaultlistener != null) {
			return defaultlistener;
		}

		defaultlistener = new Listener<BaseEvent>() {
			public void handleEvent(BaseEvent be) {
				sync++;
				try {
					if (sync == 1) {
						if (be.getType() == Events.Select) {
							if (be.getSource().equals(" 按钮变量")) {

							}
						}/* else if (be.getType() == Events.Changed) {
							if(be.getSource().equals(C_num3))
							{
								setMarkValue();
								
							}
							else if(be.getSource().equals(C_num4))
							{
								setMarkValue();
							}
							else if(be.getSource().equals(C_num5))
							{
								setMarkValue();
							}
							else if(be.getSource().equals(C_num6))
							{
								setMarkValue();
							}
						}*/ else if (be.getType() == Events.KeyUp) {
//							if (be instanceof ComponentEvent) {
//							
//							}
							
						}
					}
				} finally {
					sync--;
				}
			}

		};
		return defaultlistener;
	}
	
	void initrenderer()
	{
		final com.base.myproject.client.tools.GreetingServiceAsync greetingService = GWT
		.create(com.base.myproject.client.tools.GreetingService.class);
greetingService.getDataSet(
		"select systembcode,bname from systembcode_view ",
		new AsyncCallback<DataSet>() {

			@Override
			public void onFailure(Throwable caught) {
				Info.display("", "失败");
			}

			@Override
			public void onSuccess(final DataSet result) {
				Info.display("", "成功");
				 GridCellRenderer gcr = new GridCellRenderer()
				{

					@Override
					public Object render(ModelData model, String property,
							ColumnData config, int rowIndex, int colIndex,
							ListStore store, Grid grid) {
						// TODO Auto-generated method stub
						for(int i=0;i<result.getRowCount();i++)
						{
							
							
							if(result.getValue(i, "systembcode").equals(model.get(property)))
							{
							return	result.getValue(i, "bname");
							}
						}
						return model.get(property);
					
					}
					
				};
				systembcodecolumn.setRenderer(gcr);
				bcodegrid.getBg().getView().refresh(false);
				systembcodecolumn_lw.setRenderer(gcr);
				lwgrid.getBg().getView().refresh(false);
				
			}

		});
	}
	
	/**
	 * 
	 */
	void setMarkValue()
	{
		String str="";
		int row=1;
		for(BusiObject bo:getStore().getModels())
		{
		
			
			str +=row+":工资从"+ bo.get("salaryfrom")+" 到"+bo.get("salaryto")+"基本工资比例："+bo.get("baserate")+"岗位工资比例："+bo.get("positionrate")+"\n";
			row++;
		}
		
		mark.setValue( str);
	}
}
